<div class="students export form">
    <div class="widget" id="widget_export">
        <div class="toggle">&nbsp;</div>
        <h3 class="handle"><?php  __('Export Student Data');?></h3>
        <div class="content">
            <div class="students import form">
                <!-- Data import form -->
                <?php extract($schemas); ?>
                <?php echo $form->create('Student', array('action'=>'export'));?>
                    <fieldset>
                        <!-- Print out fields that can be exported -->
                        <p><?php __('select fields to export'); ?>
                            <a id="schema_check_all" href="javascript:void(0)" title="select all"><?php __('checkAll'); ?></a>
                            <a id="schema_check_none" href="javascript:void(0)" title="select none"><?php __('unCheckAll'); ?></a>
                        </p>
                        <!-- Print Fields lists -->
                        <?php foreach($schema as $name=>$group): ?>
                            <?php $group_class = Inflector::humanize($name); ?>
                            <div id="group_<?php e($name); ?>" class="group">
                               <p class="header">
                                    <span><?php e($group_class); ?></span>
                                    <a group="<?php e($name); ?>"
                                         class="schema_check_all"
                                         href="javascript:void(0)"
                                         title="select all <?php e($group_class); ?>"><?php __('checkAll'); ?></a>
                                    <a group="<?php e($name); ?>"
                                         class="schema_check_none"
                                         href="javascript:void(0)"
                                         title="select no <?php e($group_class); ?>"><?php __('unCheckAll'); ?></a>
                                </p>
                                <?php foreach($group as $value): ?>
                                    <?php if(!in_array($value, $blacklist)): ?>
                                        <p class="schema <?php e($name); ?>">
                                        <?php echo $form->input('Student.export.fields.'.$value,
                                            array(
                                                'type'=>'checkbox',
                                                'class'=>'checkbox',
                                                'label'=>__(Inflector::humanize($value), true)
                                            )
                                        );?>
                                        </p>
                                    <?php endif; ?>
                                <?php endforeach; ?>
                            </div>
                        <?php endforeach; ?><br class="clear"/>
                        <!-- Print sort orders and fields -->
                        <p><?php __('sort by the following field and order'); ?><br />
                        <?php echo $form->input('Student.export.order.by',
                            array('options' => $orders, 'class'=>'select', 'type'=>'select', 'label'=>false)
                            ); ?>
                        <?php echo $form->input('Student.export.order.order',
                            array('class'=>'checkbox','type'=>'checkbox','label'=> __('Sort ASC?', true))
                            ); ?>
                        </p><br />
                        <?php echo $form->submit(__('Export Selected Fields', true), array('class'=>'submit attention'));?>
                    </fieldset>
                <?php echo $form->end();?>
            </div>
            <?php //debug($specified); //debug($schema); ?>
        </div>
    </div>
</div>
<script type="text/javascript">
jQuery(function(){
    $('label').addClass('checkbox');
    /* Bind schema selector togglers */
    $('a#schema_check_all').click(function(){
        $('input[type=checkbox]').attr('checked', true);
    });
    $('a#schema_check_none').click(function(){
        $('input[type=checkbox]').attr('checked', false);
    });
    $('a.schema_check_all').click(function(){
        var parent = $('#group_'+$(this).attr('group'));
        $('input[type=checkbox]', parent).attr('checked', true);
    });
    $('a.schema_check_none').click(function(){
        var parent = $('#group_'+$(this).attr('group'));
        $('input[type=checkbox]', parent).attr('checked', false);
    });
});
</script>